package com.reformer.commons.constant;

/**
 * 第三方支付业务类型
 *
 * @author sdc
 * @version 1.0
 * @since 1.0
 */
public enum BusinessTypeEnum {
    /**
     * 路侧停车收费
     */
    ROADSIDE_CHARGE(1, "路侧停车收费"),
    /**
     * 车主钱包充值
     */
    WALLET_RECHARGE(2, "车主钱包充值"),
    /**
     * 车主包月支付
     */
    MONTHLY_PAYMENT(3, "车主包月支付"),
    /**
     * 营业厅-路侧停车收费
     */
    HALL_ROADSIDE_CHARGE(4, "营业厅-路侧停车收费"),
    /**
     * 营业厅-车主钱包充值
     */
    HALL_WALLET_RECHARGE(5, "营业厅-车主钱包充值"),
    /**
     * 营业厅-车主包月支付
     */
    HALL_MONTHLY_PAYMENT(6, "营业厅-车主包月支付"),
    /**
     * 行呗-停车缴费
     */
    XB_CHARGE(7, "行呗-停车缴费");

    private int code;
    private String name;

    BusinessTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 返回业务码对应的业务枚举对象
     *
     * @param code
     * @return
     */
    public static BusinessTypeEnum findByCode(int code) {
        for (BusinessTypeEnum type : BusinessTypeEnum.values()) {
            if (code == type.getCode()) {
                return type;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
